import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2024-03-05
 * Time: 17:47
 */
public class Test {

    public static void main35(String[] args) {
        int[][] array = new int[][]{{ 1 , 2 , 3 }, { 4 , 5, 6}};
        System.out.println(array.length);
        System.out.println(array[0]);
        System.out.println(array[1]);
        System.out.println(array[0].length);
        System.out.println(array[1].length);
        System.out.println(Arrays.toString(array[0]));
        System.out.println(Arrays.toString(array[1]));
        for (int i = 0; i < array.length; i++) {
            System.out.print("[");
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j]);
                if(j < array[i].length - 1){
                    System.out.print(" ,");
                }
            }
            System.out.print("]");
            System.out.println();
        }
        System.out.println(Arrays.deepToString(array));
        int[][] array2 = new int[2][];
        array2[0] = new int[]{ 1 , 2 , 3 };
        array2[1] = new int[]{ 4 , 5 , 6 , 7 , 8 , 9 , 10 };
        System.out.println(Arrays.deepToString(array2));
    }



    public static void reverse(int[] array){
        int left = 0;
        int right = array.length - 1;
        int tmp = -1;
        while (left < right){
            tmp = array[left];
            array[left] = array[right];
            array[right] = tmp;
            left++;
            right--;
        }
    }

    public static void main34(String[] args) {
        int[] array = new int[]{ 1, 2 , 3, 4, 5, 6, 7};
        reverse(array);
        System.out.println(Arrays.toString(array));
    }



    public static void main33(String[] args){
        Scanner scan = new Scanner(System.in);
        int[][] array1 = new int[][]{{ 1 , 2, 3 },{ 4 , 5, 6}};
        int[][] array2 = {{ 1, 2 ,3 }, { 4 , 5 , 6}};
        int row = scan.nextInt();
        int low = scan.nextInt();
        int[][] array3 = new int[row][low];
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < low; j++) {
                System.out.print(array1[i][j] + " ");
            }
            System.out.println();
        }
        System.out.println("============================");
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < low; j++) {
                System.out.print(array2[i][j] + " ");
            }
            System.out.println();
        }
        System.out.println("============================");
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < low; j++) {
                System.out.print(array3[i][j] + " ");
            }
            System.out.println();
        }
    }



    public static boolean fid(int[] array){
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if(array[i] % 2 != 0){
                count++;
                if(count == 3){
                    return true;
                }
            }else {
                count = 0;
            }
        }
        return false;
    }

    public static void main32(String[] args) {
        int[] array = new int[]{ 1 , 2 , 34 , 3 , 4 , 5 , 7 , 23 , 12 };
        System.out.println(fid(array));
    }



    public static void main31(String[] args) {
        int[] array = new int[]{ 1 , 2 , 34 , 3 , 4 , 5 , 7 , 23 , 12 };
        int count = 0;
        int i = 0;
        for (; i < array.length; i++) {
            if(array[i] % 2 != 0){
                count++;
                if(count == 3){
                    break;
                }
            }else {
                count = 0;
            }
        }
        int[] ret = {array[i - 2], array[ i - 1] , array[i]};
        System.out.println(Arrays.toString(ret));
    }



    public static void main(String[] args) {
        //int[] array = new int[]{ 1, 1, 6, 6, 6, 4, 6, 6, 6, 7, 2, 6 };
        int[] array = new int[]{ 1, 1, 2, 2, 3, 4, 6, 10, 7, 2, 6 };

        int left = 0;
        int right = array.length - 1;
        int ret = 0;
        int i = 0;
        Arrays.sort(array);
        Arrays.sort(array);
        System.out.println(Arrays.toString(array));

        while (left < right) {
            if(((array[left]) ^ (array[right])) != 0 ){
                left++;
                right--;
            }else {
                ret = array[left];
                left++;
            }
        }

        int count = 0;
        for (int j = 0; j < array.length; j++) {
            if(array[j] == ret){
                count++;
            }
        }
        if(count > array.length / 2){
            System.out.println(array[ret]);
        }else {
            System.out.println("你所要查询的数字不存在");
        }

    }



    public static void main29(String[] args) {
        int[] array = new int[]{ 1, 6, 2, 6, 4, 6, 6, 6, 7, 2, 6 };
        Arrays.sort(array);
        int ret = array[array.length / 2];
        System.out.println(ret);
    }



    public static int find(int[] array){
        int ret = array[0];
        for (int i = 1; i < array.length; i++) {
            ret ^= array[i];
        }
        return ret;
    }

    public static void main28(String[] args) {
        int[] array = new int[]{1, 2,  3,  1, 4, 2, 4, 3 , 5 };
        System.out.println(find(array));
    }



    public static int[] func(int[] array , int k){
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = i + 1; j < array.length; j++) {
                if(array[i] + array[j] == k){
                    return new int[]{i , j};
                }
            }
        }
        return new int[]{-1 , -1};
    }

    public static void main27(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] array = new int[]{ 2, 7, 11, 15 };
        int key = scanner.nextInt();
        int[] ret = func(array, key);
        System.out.println(Arrays.toString(ret));
    }



    public static void func(int[] array){
        int left = 0;
        int right = array.length - 1;
        for (int i = 0; i < array.length; i++) {
            while (left < right){
                while (left < right && array[left] % 2 != 0){
                    left++;
                }
                while (left < right && array[right] % 2 == 0){
                    right--;
                }
                int tmp = array[left];
                array[left] = array[right];
                array[right] = tmp;
            }
        }
    }

    public static void main26(String[] args) {
        int[] array = new int[]{1,2 ,3 ,4 ,5 ,6};
        func(array);
        System.out.println(Arrays.toString(array));
    }



    public static double avg(int[] array){
        double sum = 0.0;
        for (int i = 0; i < array.length; i++) {
            sum += array[i];
        }
        return sum / array.length;
    }

    public static void main25(String[] args) {
        int[] array = new int[]{1, 2 ,3 ,4 ,5 , 6};
        System.out.println(avg(array));
    }



    public static void transform(int[] array){
        for (int i = 0; i < array.length; i++) {
            array[i] = array[i] * 2;
        }
    }

    public static int[] transform2(int[] array){
        int[] ret = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            ret[i] = array[i] * 2;
        }
        return ret;
    }

    public static void main24(String[] args) {
        int[] array = new int[]{1 ,2 ,3};
        System.out.println(Arrays.toString(array));

        int[] ret = transform2(array);
        System.out.println(Arrays.toString(ret));
    }



    public static void boubbleSort(int[] array){
        boolean flag = true;
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = 0; j < array.length - 1 - i; j++) {
                flag = false;
                if (array[j] > array[j + 1]){
                    int tmp = array[j];
                    array[j] = array[j + 1];
                    array[j + 1] = tmp;
                }
            }
            if (flag == true){
                break;
            }
        }
    }

    public static void main23(String[] args) {
        int[] array = new int[]{1, 4, 3, 7, 9, 2, 6, 5, 8 };
        boubbleSort(array);
        System.out.println(Arrays.toString(array));
    }



    public static void main22(String[] args) {
        int[] array = new int[]{1 ,12 ,32 ,14 ,5 };
        Arrays.sort(array);
        Arrays.toString(array);
        System.out.println(Arrays.toString(array));
        int[] array2 = new int[]{1 ,2 ,3 ,4 ,5 };
        System.out.println(Arrays.toString(array));
        boolean flg = Arrays.equals(array,array2);
        System.out.println(flg);
        System.out.println("===============================================");

        int[] array3 = new int[]{1 ,12 ,32 ,14 ,5 };
        System.out.println(Arrays.toString(array3));
        int[] array4 = new int[]{1 ,12 ,32 ,14 ,5 };
        System.out.println(Arrays.toString(array4));
        System.out.println(Arrays.equals(array3, array4));
        System.out.println("===============================================");

        int[] array5 = new int[10];
        Arrays.fill(array5, -1) ;
        System.out.println(Arrays.toString(array5));
        System.out.println("===============================================");

        int[] array6 = new int[10];
        Arrays.fill(array6, 1 , 3,-1) ;
        System.out.println(Arrays.toString(array6));
    }



    public static void main20(String[] args) {
        int[] array = { 1, 12 ,3 ,41 ,75 ,6 };
        Arrays.sort(array);
        System.out.println(Arrays.toString(array));

        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        System.out.println(Arrays.binarySearch(array, k));
    }



    public static int binarySearch(int[] array , int k){
        int left = 0;
        int right = array.length - 1;
        while (left <= right){
            int mid = ((right - left) >>> 1) + left;
            if (array[mid] == k){
                return mid;
            }else if (array[mid] > k){
                right = mid - 1;
            }else {
                left = mid + 1;
            }
        }
        return -1;
    }

    public static void main19(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] array = new int[]{ 1 , 23, 39, 24 , 35 , 20 };
        Arrays.sort(array);
        System.out.println(Arrays.toString(array));

        int k = scan.nextInt();
        System.out.println(binarySearch(array, k));
    }




    public static int findVal(int[] array , int k){
        for (int i = 0; i < array.length; i++) {
            if (array[i] == k){
                return i;
            }
        }
        return -1;
    }

    public static void main18(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] array = {1 ,2 ,3 ,4 ,5 };
        int k = scan.nextInt();
        System.out.println(findVal(array, k));
    }



    public static void main17(String[] args) {
        int[] array = {1 ,2 , 3, 4, 5, 6};
        double sum = 0.0;
        for (int i = 0; i < array.length; i++) {
            sum += array[i];
        }
        System.out.println(sum / array.length);
    }



    public static void main16(String[] args) {
        int[] array = {1 ,2 , 3, 4, 5, 6};
        double sum = 0.0;
        for (int x :
             array) {
            sum += x;
        }
        System.out.println(sum / array.length);
    }



    public static void main15(String[] args) {
        int[] array = new int[]{ 1, 2, 3 , 4, 5 };
        int[] copy = new int[array.length];
        System.arraycopy(array, 0 , copy , 0 ,array.length);
        System.out.println(Arrays.toString(copy));
    }



    public static void main14(String[] args) {
        int[] array = new int[]{1, 2, 3, 4, 5};
        int[] copy = Arrays.copyOf(array, array.length);
        int[] copy2 = Arrays.copyOf(array, array.length * 2);
        int[] copy3 = Arrays.copyOfRange(array, 1,3);

        System.out.println(Arrays.toString(copy));
        System.out.println(Arrays.toString(copy2));
        System.out.println(Arrays.toString(copy3));
    }



    public static void main13(String[] args) {
        int[] array = new int[]{1, 2, 3, 4, 5};
        int[] copy = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            copy[i] = array[i];
        }
        System.out.println(Arrays.toString(copy));
    }



    public static String myToString(int[] array){
        String s = "[";
        for (int i = 0; i < array.length; i++) {
            s += array[i];
            if (i < array.length - 1){
                s += ",";
            }
        }
        s += "]";
        return  s;
    }

    public static void main12(String[] args) {
        int[] array = new int[] { 1 , 2 , 3 , 4 , 5 };
        System.out.println(myToString(array));
    }



    public static void main11(String[] args) {
        int[] array = new int[]{1, 2, 3, 4, 5};
        String a = Arrays.toString(array);
        System.out.println(a);
        System.out.println(Arrays.toString(array));
    }



    public static int[] fuc3(){
        int[] array = { 1, 2, 3, 4, 5, 6};
        return array;
    }

    public static void main10(String[] args) {
        int[] ret= fuc3();
        for (int i = 0; i < ret.length; i++) {
            System.out.print(ret[i] + " ");
        }
        System.out.println();
    }



    public  static void func1(int[] array){
        array = new int[10];
    }

    public static void func2(int[] array){
        array[0] = 99;
    }
    public static void main9(String[] args) {
        int[] array1 = { 1, 2, 3, 4 };
        func1(array1);
        for (int i = 0; i < array1.length; i++) {
            System.out.print(array1[i] + " ");
        }
        System.out.println();
        int[] array2 = { 1, 2, 3, 4 };
        func2(array2);
        for (int i = 0; i < array2.length; i++) {
            System.out.print(array2[i] + " ");
        }
    }



    public  static int fib(int num){
            if(num == 0 || num == 1){
                return 1;
            }
            else {
                return fib(num - 1) * num;
            }
    }

    public static void main8(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        System.out.println(fib(num));
    }



    public static int add(int x , int y){
        return x + y;
    }

    public static double add(double x, double y ,double z){
        return x + y + z;
    }

    public static void main7(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int num2 = scan.nextInt();
        System.out.println(add(num, num2));
        double num3 = scan.nextDouble();
        double num4 = scan.nextDouble();
        double num5 = scan.nextDouble();
        System.out.println(add(num3, num4, num5));
    }



    public static void main6(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int sum = 1;
        int ret = 0;
        for (int i = 1; i <= n ; i++) {
            sum = 1;
            for (int j = 1; j <= i ; j++) {
                sum *= j;
            }
            ret += sum;
        }
        System.out.println(ret);
    }



    public static void main5(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int sum = 1;
        for (int i = 1; i <= num ; i++) {
            sum *= i;
        }
        System.out.println(sum);
    }



    public static void main4(String[] args) {
        int[] array = { 1, 2, 3, 4 };
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
        System.out.println();

        for (int x:
             array) {
            System.out.print( x + " ");
        }
        System.out.println();
    }



    public static int max2(int num1, int num2){
        return (num1 > num2) ? num1 : num2;
    }

    public static int max3(int num1, int num2, int num3){
        int max = max2(num1 , num2);
        return max2(max, num3);
    }

    public static void main3(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num1 = scan.nextInt();
        int num2 = scan.nextInt();
        int num3 =scan.nextInt();
        System.out.println(max2(num1, num2));
        System.out.println(max3(num1, num2, num3));
    }



    public static void main1(String[] args) {
        int[] array1  =  { 1 , 2, 3, 4 };
        System.out.print(array1[0] + " ");
        System.out.print(array1[1] + " ");
        System.out.print(array1[2] + " ");
        System.out.print(array1[3] + " ");

        System.out.println();
        System.out.println("==================");

        System.out.println(array1.length);
        System.out.println("==================");


        for (int i = 0; i < array1.length; i++) {
            System.out.print(array1[i] + " ");
        }
        System.out.println();

        System.out.println("==================");

        for (int x :
             array1) {
            System.out.print(x + " ");
        }
        System.out.println();
        System.out.println("==================");

        double[] array2 = new double[10];
        float[] array3 = new float[]{1.0f , 2.0f , 3.0f , 4.0f , 5.0f , 6.0f};
        System.out.println(array1);
        System.out.println(array2);
        System.out.println(array3);

        System.out.println("=================");
    }



    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入您要操作的两个数值：");
        double num1 = scan.nextDouble();
        double num2 = scan.nextDouble();
        System.out.println();
        System.out.println("两个数值中的较大值是：" + Math.max(num1, num2));
        System.out.println("=================");
        System.out.println("两个数平方后的值是：" + Math.pow(num1, num2));
        System.out.println("=================");
        System.out.println("第一个数开平方后的值是：" + Math.sqrt(num1));
        System.out.println("=================");
        System.out.println("两个数值中的较小值是：" + Math.min(num1, num2));
        System.out.println("=================");
        System.out.println("第一个数四舍五入之后的值是：" + Math.round(num1));
        System.out.println("=================");
    }

}
